﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BarberShop.Model;
using BarberShop.Data;
namespace BarberShop.BLL
{
    public class UserInfoBLL
    {
        public static UserInfoModel GetModel(int id)
        {
            using (DataClassesDataContext data = new DataClassesDataContext())
            {
                var info=data.UserInfo.Where(r => r.ID == id).FirstOrDefault();
                return UserInfoModel.ConvertDataModel(info);
            }
        }
        public static bool ValidateUser(string username,string password)
        {
            using (DataClassesDataContext data = new DataClassesDataContext())
            {
                var info=data.UserInfo.Where(r =>r.Loginname==username&&r.Password==password).FirstOrDefault();
                return info != null;
            }
        }
        
    }
}
